package com.example.demo.service.impl;

import com.example.demo.dao.entity.UserInfo;
import com.example.demo.dao.mapper.UserInfoMapper;
import com.example.demo.model.UserInfoVo;
import com.example.demo.service.UserInfoService;
import com.example.demo.util.RedisUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 后台管理用户表 服务实现类
 * </p>
 *
 * @author jacheut
 * @since 2018-07-05
 */
@Service
public class UserInfoServiceImpl implements UserInfoService {

    @Autowired
    private UserInfoMapper userInfoMapper;

    @Autowired
    private RedisUtils redisUtils;

    @Override
    public List<UserInfo> getAllUserInfos() {
        return userInfoMapper.selectByExample(null);
    }

    @Override
    public void addUserInfo(UserInfoVo userInfoVo) {
        UserInfo record = new UserInfo();
        BeanUtils.copyProperties(userInfoVo, record);
        userInfoMapper.insertSelective(record);
    }
}
